{__NOLAYOUT__}
<include file="Public/meta"/>
        
        

        <div class="container-fluid">
            <div class="row-fluid">
                    
<div class="btn-toolbar">
    <button class="btn btn-primary" id="submit"><i class="icon-save"></i> 提交</button>
    <!-- <a href="#myModal" data-toggle="modal" class="btn">删除</a> -->
  <div class="btn-group">
  </div>
</div>
<div class="well">
    
    <div id="myTabContent" class="tab-content">
      <div class="tab-pane active in" id="home">
    <form id="tab" method='post'>
        <label>用户名</label>
        <input type="text" value="" class="input-xlarge" name="username" id="username">
        <label>昵称</label>
        <input type="text" value="" class="input-xlarge" name="nickname" id="nickname">
        <label>密码</label>
        <input type="password" value="" class="input-xlarge" name="password" id="password">
        <label>确认密码</label>
        <input type="password " value="" class="input-xlarge" name="passaff" id="passaff">
        <label>手机号码</label>
        <input type="text" value="" class="input-xlarge" name="phone" id="phone">
        <label>邮箱</label>
        <input type="text" value="" class="input-xlarge" name="email" id="email">
        <label>性别</label>
        <input type="radio" value="0" name="gender" class="input-xlarge" checked="">男
        <div style="width: 50px;display: inline-block;"></div>
        <input type="radio" value="1" name="gender" class="input-xlarge">女
       <!--  <label>Address</label>
        <textarea value="Smith" rows="3" class="input-xlarge">

        </textarea> -->
        <label>状态</label>
        <select name="status" id="status" class="input-xlarge">
          <option value="1">正常</option>
          <option value="1">冻结</option>
        </select>
    </form>
      </div>
      <div class="tab-pane fade" id="profile">
   
      </div>
  </div>

</div>

<div class="modal small hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">Delete Confirmation</h3>
  </div>
  <div class="modal-body">
    
    <p class="error-text"><i class="icon-warning-sign modal-icon"></i>Are you sure you want to delete the user?</p>
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
    <button class="btn btn-danger" data-dismiss="modal">Delete</button>
  </div>
<!-- </div> -->



<script type="text/javascript">

  function userblur(){
      var username = $('#username').val();
      if(username==''){
        layer.msg('账号不可为空,由8—16位英文或数字组成,开头不为数字',{icon:2,time:1000});return false;
      }else{
        return true;
      }
  }

  function ninameblur(){
    var nickname = $('#nickname').val();
      if(nickname==''){
        layer.msg('昵称不可为空',{icon:2,time:1000});return false;
      }else{
        return true;
      }
  }

  function passblur(){
      var password = $('#password').val();
      if(password==''){
        layer.msg('密码不可为空,由6—16位英文或数字组成',{icon:2,time:1000});return false;
      }else{
        return true;
      }
  }

  function passaffblur(){
      var password = $('#password').val();
      var passaff = $('#passaff').val();
      if(password != passaff){
        layer.msg('两次密码不一致',{icon:2,time:1000});return false;
      }else{
        return true;
      }
  }

  function phoneblur(){
      var phone = $('#phone').val();
      if(phone==''){
        layer.msg('手机号码不可为空且不可重复',{icon:2,time:1000});return false;
      }else{
        return true;
      }
  }

  function emailblur(){
      var email = $('#email').val();
      if(email==''){
        layer.msg('邮箱不可为空且不可重复',{icon:2,time:1000});return false;
      }else{
        return true;
      }
  }

  $('#username').blur(function(){
      userblur();
  })

  $('#nickname').blur(function(){
     ninameblur();
  })

  $('#password').blur(function(){
      passblur();
  })

  $('#passaff').blur(function(){
      passaffblur();
  })

  $('#phone').blur(function(){
      phoneblur();
  })

  $('#email').blur(function(){
      emailblur();
  })

  $("#submit").click(function(){
      
      

      //提交前确认信息无误

      if(userblur()){
        if(ninameblur()){
           if(passblur()){
              if(passaffblur()){
                if(phoneblur()){
                  if(emailblur()){
                      var formdate = $("#tab").serialize();

                      
                      $.ajax({
                        url:"",
                        type:'post',
                        dataType:'json',
                        data:formdate,
                        success:function(msg){
                          if(msg.code=='1'){
                            layer.msg(msg.info,{icon:1,time:1000},function(index){
                              window.parent.location.reload();
                            });

                          }else{
                            layer.msg(msg.info,{icon:2,time:1000});
                            return false;
                          }
                        }
                      })
                  }
                }
              }
           }
        }
      }
      


      
  })
  
</script>